/*
 *  Driver.cpp
 *  TubeTruck
 *
 *  Created by Aeturnum on 5/22/08.
 *  Copyright 2008 __MyCompanyName__. All rights reserved.
 *
 */

#include "BlowFish.h"
#include "TubeTruckTypes.h"
#include <vector>

using namespace std;

int main(int argc, char* argv[]) {
   int key[16] = {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15};
   int iv[8] = {1,2,3,4,5,6,7,8};
   char msg[] = "Test";
   
   vector<byte> keyVec(key,key+16);
   vector<byte> ivVec(iv, iv+8);
   vector<byte> msgVec(msg, msg+strlen(msg));
   
   TTP::Crypt::BlowFish bf(keyVec,ivVec);
   
   vector<byte> result1(bf.encrypt(msgVec));
   vector<byte> result2(bf.decrypt(result1));
   
   printf("Result1 (%d) : \n",(int)result1.size());
   
   for(unsigned int i = 0; i < result1.size(); i++) {
      printf("%c", result1[i]);
   }
   
   printf("Result2 (%d) : \n",(int)result2.size());
   
   for(unsigned int i = 0; i < result2.size(); i++) {
      printf("%c", result2[i]);
   }
   
   return 1;
}

